0725e4
@@ -220,14 +220,16 @@
public class SetUniqueList extends AbstractSerializableListDecorator {
     public Object set(int index, Object object) {
         int pos = indexOf(object);
         Object removed = super.set(index, object);
-        if (pos == -1 || pos == index) {
-            return removed;
+
+        if (pos != -1 && pos != index) {
+            // the object is already in the uniq list
+            // (and it hasn't been swapped with itself)
+            super.remove(pos);  // remove the duplicate by index
         }
-        
-        // the object is already in the uniq list
-        // (and it hasn't been swapped with itself)
-        super.remove(pos);  // remove the duplicate by index
+
+        set.add(object);      // add the new item to the unique set
         set.remove(removed);  // remove the item deleted by the set
+
         return removed;  // return the item deleted by the set
     }
 
